<!DOCTYPE HTML>
<html>

<head>
	<meta charset="utf-8">
	<title>中国象棋 in html5</title>
	<!--
/**
 * ChinaChess - in html5
 * http://www.jnzo.com/chess/
 * @ author 一叶孤舟
 * @ mail itlwei@163.com
 * @ QQ 28701884
 */
-->
	<link href="css/chess.css" rel="stylesheet" type="text/css">
</head>

<body>
	<div class="box" id="box">
		<div class="chess_left">
			<canvas id="chess">对不起，您的浏览器不支持HTML5，请升级浏览器至IE9、firefox或者谷歌浏览器！</canvas>
			<!--<audio src="audio/click.wav" id="clickAudio" preload="auto"></audio>-->
			<!--<audio src="audio/check.wav" id="checkAudio" preload="auto"></audio>-->
			<!--<audio src="audio/select.wav" id="selectAudio" preload="auto"></audio>-->
		</div>
		<div class="chess_right">
			<!--<div class="bn_box" id="bnBox">-->
				<span id="tip">点击下方按钮开始棋局</span>
			<label for="chessboard">棋盘</label>

			<select name="chessboard" id="chessboard">
						<option value="1">1</option>
						<option value="2">2</option>
						<option value="3">3</option>
						<option value="4">4</option>
						<option value="5">5</option>
						<option value="6">6</option>
						<option value="7">7</option>
						<option value="8">8</option>
						<option value="9">9</option>
					</select>
			<br>
			
			<button id="tyroPlay">开始对弈</button>
			<!--<input type="button" fromTo="offensivePlay" id="superPlay" value="中级水平" />-->
			<!--<input type="button" fromTo="button" id="" value="大师水平" disabled />
				
			<input type="button" fromTo="offensivePlay" id="offensivePlay" value="先手开始" />
			<input type="button" fromTo="defensivePlay" id="defensivePlay" value="后手开始" />
			-->
			<button id="regretBn">悔棋</button>
			<button id="helpBtn">帮我一下</button>
			<!--<input type="button" fromTo="billBn" id="billBn" value="棋谱" class="bn_box" />-->
			<!--<input type="button" fromTo="stypeBn" id="stypeBn" value="换肤" />
				<input type="button" fromTo="download" id="download" value="源码下载" onClick="window.open('https://github.com/itlwei/ChinaChess-html5')" />-->
			<!--</div>-->
		</div>
		
		<!--<div class="chess_right" id="chessRight">
			<select fromTo="billList" id="billList">
			</select>
			<ol id="billBox" class="bill_box">
			</ol>
		</div>
		<div id="moveInfo" class="move_info"></div>-->
	</div>
	<div id="explain"></div>
		<div id="helpMessage"></div>
	<!--Libs-->
	<script src="js/lib/jquery.min.js"></script>
	<script src="js/lib/sockjs.min.js"></script>
	<script src="js/lib/stomp.min.js"></script>
	<!--Impl-->
	<script src="js/socket.js"></script>
	<script type="text/javascript" src="js/common.js"></script>
	<script type="text/javascript" src="js/play.js"></script>
	<!--Not useful any more-->
	<!--<script type="text/javascript" src="js/AI.js"></script>-->
	<!--<script type="text/javascript" src="js/bill.js"></script>-->
	<!--<script type="text/javascript" src="js/gambit.js"></script>-->
	<div style="display: none"></div>
	<script>
		window.onload = function() {
			com.bg = new com.class.Bg();
			com.dot = new com.class.Dot();
			com.pane = new com.class.Pane();
			com.pane.isShow = false;

			com.childList = [ com.bg, com.dot, com.pane ];
			com.mans = {}; //棋子集合
			com.createMans(com.initMap) //生成棋子
			com.bg.show();
			// com.get("bnBox").style.display = "block";
			//play.init();
			// com.get("billBn").addEventListener("click", function (e) {
			// 	if (confirm("是否结束对局，开始棋局研究？")) {
			// 		com.init();
			// 		com.get("chessRight").style.display = "block";
			// 		com.get("moveInfo").style.display = "none";
			// 		bill.init();
			// 	}
			// })
			// com.get("superPlay").addEventListener("click", function (e) {
			// 	if (confirm("确认开始大师级对弈？")) {
			// 		play.isPlay = true;
			// 		com.get("chessRight").style.display = "none";
			// 		com.get("moveInfo").style.display = "block";
			// 		com.get("moveInfo").innerHTML = "";
			// 		play.depth = 4;
			// 		play.init();
			// 	}
			// })

			play.connectServer()

			com.get("tyroPlay").addEventListener("click", function(e) {
				// if (confirm("确认开始对弈？")) {
				play.isPlay = true;
				// com.get("chessRight").style.display = "none";
				// com.get("moveInfo").style.display = "block";
				// com.get("moveInfo").innerHTML = "";
				// play.depth = 3;
				// play.init();


				var index = document.getElementById('chessboard').value;
				play.socket.sendMessage("/app/init", parseInt(index))
				// }
			})

			com.get("helpBtn").addEventListener("click", function(e) {
				// if (confirm("确认开始对弈？")) {
				play.socket.sendMessage("/app/help", 1)
				// }
			})

			// com.get("stypeBn").addEventListener("click", function (e) {
			// 	var stype = com.nowStype;
			// 	if (stype == "stype1") stype = "stype2";
			// 	else if (stype == "stype2") stype = "stype1";
			// 	com.init(stype);
			// 	com.show();
			// 	play.depth = 4;
			// 	play.init();
			// 	document.cookie = "stype=" + stype;
			// 	clearInterval(timer);
			// 	var i = 0;
			// 	var timer = setInterval(function () {
			// 		com.show();
			// 		if (i++ >= 5) clearInterval(timer);
			// 	}, 2000);
			// })

			// com.getData("js/gambit.all.js",
			// 	function (data) {
			// 		com.gambit = data.split(" ");
			// 		AI.historyBill = com.gambit;
			// 	})

			// com.getData("js/store.js",
			// 	function (data) {
			// 		com.store = data.split(" ");
			// 	})

			//			// 直接开始哈哈哈哈
			//			play.isPlay = true;
			//			com.get("chessRight").style.display = "none";
			//			com.get("moveInfo").style.display = "block";
			//			com.get("moveInfo").innerHTML = "";
			//			play.depth = 3;
			//			play.init();
		}
	</script>
</body>

</html>